<script type="text/javascript" src="{{ uploadify_path }}swfobject.js"></script>
<script type="text/javascript" src="{{ uploadify_path }}jquery.uploadify.js"></script>
<div id="uploadify" class="multi-file-upload"><input id="fileInput" name="fileInput" type="file" /></div>
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {

$('#fileInput').uploadify({
'uploader'  : '{{ uploadify_path }}uploadify.swf',
'script'    : '{% url tardis.tardis_portal.views.upload dataset_id %}',
'cancelImg' : '{{ uploadify_path }}cancel.png',
'auto'      : false,
'folder'    : '{{ upload_path }}',
'multi'     : true,
'onAllComplete' : allComplete
});
});

function allComplete(event, data) {
    // $('#uploadify').load('{{ upload_complete_url }}', {
    //     'filesUploaded': data.filesUploaded,
    //     'errorCount': data.errors,
    //     'allBytesLoaded': data.allBytesLoaded,
    //     'speed': data.speed
    // });
    // Raise custom event
    $('#uploadify').trigger('allUploadsComplete', data);

}
// ]]></script>